package com.flash.InventoryManagement.mapper;

import com.flash.InventoryManagement.entity.CashAccrualStock;
import com.flash.InventoryManagement.entity.SecurityAccrualStock;
import com.flash.InventoryManagement.entity.SecurityStock;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/**
 * @author jr
 * @version 1.0
 * @date 2022/8/26
 */
@Mapper
public interface SecurityAccrualStockMapper {
    //查询
    @Select("select * from (select rownum rn,s.* from securityAccrualStock s) s" +
            " join Security s2 on s.securityId = s2.securityId"+
            " where 1=1 ${strWhere} and rn between #{page} and #{limit}")

    public List<SecurityAccrualStock> selectSecurityAccrualStock(Map map);
    //分页记录数
    @Select("select count(*) from securityAccrualStock")
    public int countSecurityAccrualStock();

    //增加
    @Insert("insert into securityAccrualStock values(#{securityAccrualStockId},#{fundId},#{securityId},#{dateAccrualStock},#{securityType},#{businessState},#{money},#{initialState},#{remark})")
    public int insertSecurityAccrualStock(SecurityAccrualStock securityAccrualStock);

    @Delete("delete from securityAccrualStock where securityAccrualStockId=#{securityAccrualStockId}")
    public int deleteSecurityAccrualStock(SecurityAccrualStock securityAccrualStock);

    @Update("update securityAccrualStock set fundId=#{fundId},securityId=#{securityId},dateAccrualStock=#{dateAccrualStock},securityType=#{securityType},businessState=#{businessState},money=#{money},initialState=#{initialState},remark=#{remark} where securityAccrualStockId=#{securityAccrualStockId}")
    public int updateSecurityAccrualStock(SecurityAccrualStock securityAccrualStock);

}
